package discount;

import DiscountEnum.DiscountEnum;
import DiscountEnum.FullReductionEnum;

import java.util.HashMap;

/**
 * 添加折扣优惠
 */
public class DiscountMap {

    private static final HashMap<String, Enum<?>> discountMap = new HashMap<>();

    public static Enum<?> getDiscountEnum(String name) {
        return discountMap.get(name);
    }

    public static void setDiscountEnum(String fruitName, Enum<?> en) {
        discountMap.put(fruitName, en);
    }

    public static void initDiscountEnum(){
        DiscountMap.setDiscountEnum("apple", DiscountEnum.discount_8);
        DiscountMap.setDiscountEnum("total", FullReductionEnum.FullReduction_100);
    }

}
